package com.ymt.fmd.platform.formdesigner.parser;

import com.ymt.fmd.appboot.prop.FmdProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;


@Component
@EnableConfigurationProperties(value = {FmdProperties.class})
public class ParserManager {

	@Autowired
	private FmdProperties fmdProperties;

	public AbstractJsParser getParser() {
		try {
			AbstractJsParser parser = (AbstractJsParser) Class.forName(fmdProperties.getParserImpl()).newInstance();
			return parser;
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
